require(['./config'], () => {
  require(['swiper', 'template', 'header','footer'], (Swiper, template) => {
    class Index {
      constructor () {
        this.banner()
        this.getList()
      }
      banner () {
        // swiper本身就是一个满足AMD规范的模块，所以需要在上面接收Swiper
        var mySwiper = new Swiper('#banner', {
          loop: true,
          autoplay: true,
          pagination: {
            el: '#banner .banner-pagination',
          },
          navigation: {
            nextEl: '#banner .swiper-button-next',
            prevEl: '#banner .swiper-button-prev',
          }
        })
      }
	  
	  getList () {	
	    $.get(`http://www.xiongmaoyouxuan.com/api/tab/4`, resp => {
	      console.log(resp)
	      if (resp.code === 200) {
	        const { list } = resp.data.items
	        const { cname } = resp.data.category
	  		
	        $('#goodsClassify').html(
	          template('classifyTempalte', {
	            cname,
	            list
	          })
	        )
	      }
	    })
	  }
    // getPddList () {
    //   // 获取代理拼多多接口渲染
    //   // https://apiv2.pinduoduo.com/api/gindex/subject/limited/goods
    //   $.get('/api/gindex/subject/limited/goods', {
    //     subject_id: 39274,
    //     page: 1,
    //     size: 50
    //   }, resp => {
    //     if (resp.result) {
    //       const { data } = resp
    //       $('#pddList').html(template('pddListTemplate', { data }))
    //     }
    //   })
    // }
     
    }
    new Index()
  })
})
